<!doctype html>
<html lang="zh">
<head>
	<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes">
	<title>Title</title>
</head>
<body>
	<button id="the-button">Try it</button>

	<script type="text/javascript">
		const button = document.querySelector('#the-button');
		button.addEventListener('click', function() {
		navigator.bluetooth.requestDevice({
		filters: [{
			services: ['battery_service']
			}]
		}).then(device => {
			console.log('Got device:', device.name);
			console.log('id:', device.id);
		});
		});
	</script>
</body>
</html>